<template lang="pug">
	.doctor-record-detail-wrap
		.address(v-if="recordList.prompt_msg") {{recordList.prompt_msg}}
		.info-box
			.info-title {{recordList.org_name}}
			.info-content
				div
					.left 就诊人
					.right {{findPatient.name}}
				div
					.left 就诊卡类型
					.right {{cardTypeText}}
		.info-box
			.info-title
				div 项目名称（{{recordList.item_name}}）
				.state {{recordList.statusText}}
			.info-content.order-info
				div(v-for="(item,index) in recordDetail" :key="index")
					.left {{item.sfxm}}
					.right ￥{{item.sfje}}
			.info-content
				div
					.left 总费用
					.right ￥{{recordList.zje}}
				div
					.left 医保报销
					.right -￥{{recordList.ybje}}
				div
					.left 自费金额
					.right ￥{{recordList.zfje1}}
		.info-box
			.info-content
				div
					.left 开单医生
					.right {{recordList.doc_name}}
				div
					.left 开单科室
					.right {{recordList.ksmc}}
				div
					.left 创建时间
					.right {{recordList.cjsj}}
</template>

<script>
export default {
	name: 'doctorRecordDetail',
	data() {
		return {
			findPatient: {},
			recordList: {},
			recordDetail: [],
			cardTypeText: ''
		}
	},
	created() {},
	mounted() {
		this.recordList = this.wx.getStorageSync('doctorRecordList')
		this.findPatient = this.wx.getStorageSync('findPatient')
		if (
			this.findPatient.cardType === '1' ||
			this.findPatient.cardType === '102'
		) {
			this.cardTypeText = '健康卡'
		} else if (this.findPatient.cardType === '101') {
			this.cardTypeText = '匿名健康卡'
		} else if (this.findPatient.cardType === '103') {
			this.cardTypeText = '实名认证健康卡'
		} else if (
			this.findPatient.cardType === '2' ||
			this.findPatient.cardType === '201'
		) {
			this.cardTypeText = '市民卡'
		} else if (this.findPatient.cardType === '202') {
			this.cardTypeText = '实名认证市民卡'
		}
		this.doctorRecordDetail()
	},
	methods: {
		doctorRecordDetail() {
			this.wx.showLoading({
				title: '加载中',
				icon: 'none'
			})
			let userInfo = this.wx.getStorageSync('userInfo')
			this.api.jtApi
				.doctorRecordDetail({
					access_token: userInfo.accessToken,
					member_num: userInfo.memberNum,
					klx: this.findPatient.cardType,
					kh: this.findPatient.cardNumber,
					idcode: this.findPatient.sscardId,
					order_no: this.wx.getStorageSync('doctorRecordList').order_no,
					stype: '1'
				})
				.then(data => {
					this.wx.hideLoading()
					if (data.ret_code === '0') {
						let recordDetail = this.tools.formatToArray(data.details.detail)
						recordDetail.forEach(item => {
							item.sfje = this.filter.formatIncome(item.sfje)
						})
						this.recordDetail = recordDetail
					}
				})
				.catch(() => {
					this.wx.hideLoading()
				})
		}
	}
}
</script>

<style lang="stylus">
	.doctor-record-detail-wrap
		padding-bottom 20px
		.info-box
			background-color white
			padding 0 30px
			margin-top 20px
			.info-title
				padding-top 30px
				font-size 30px
				font-weight 600
				color blackFontColor1A
				display flex
				justify-content space-between
				align-items center
				.state
					color #FDAF3D
			.info-content
				padding-bottom 30px
				>div
					display flex
					justify-content space-between
					align-items center
					font-size 28px
					padding-top 30px
					.left
						color grayFontColor88
					.right
						color blackFontColor1A
			.order-info
				border-bottom borderStyle
				.left
					width 60%
				.center
					min-width 15%
					text-align center
				.right
					text-align right
					min-width 25%
		.address
			border-bottom 1px solid themeColor
			padding 30px
			text-align center
			color themeColor
			background-color #ECF3FF
</style>
